/**
 * 
 */
package any.restlet.helper;

import org.restlet.data.Response;
import org.restlet.data.Status;
import org.restlet.resource.Representation;
import org.restlet.resource.Variant;

/**
 * TODO: Doc me
 * 
 * @author keke <keke@codehaus.org>
 * @version
 * @revision $Revision:$
 */
public class RepresentationHelperUtil {
    public static Representation represent(final Object entity, final Variant variant,
            final String name, final RepresentationHelper repHelper, final Response response) {
        final Representation rep = repHelper.toRepresentation(name, entity, variant);
        if(rep!=null){
            return rep;
        }
        response.setStatus(Status.CLIENT_ERROR_NOT_ACCEPTABLE);
        return null;
    }
}
